package com.artpri.dao.impl;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.artpri.dao.GoodsOrderDao;
import com.artpri.model.GoodsOrder;

/**
 * 
 * @author ZhangSi
 *
 */
public class GoodsOrderDaoImpl extends HibernateDaoImpl<GoodsOrder> implements GoodsOrderDao{

	@Override
	public List<Integer> save(List<GoodsOrder> goodsOrders) {
		List<Integer> list = new ArrayList<>();
		for (Iterator<GoodsOrder> it = goodsOrders.iterator(); it.hasNext();) {
			GoodsOrder goodsOrder = (GoodsOrder) it.next();
			list.add((Integer)save(goodsOrder));
		}
		return list;
	}

	@Override
	public List<GoodsOrder> findByOrder(Integer orderId) {
		return find("from GoodsOrder g where g.orderId=?0", orderId);
	}

}
